//package com.burges.net.dataStream.async
//
//import java.util.concurrent.TimeUnit
//
//import org.apache.flink.runtime.concurrent.Executors
//import org.apache.flink.streaming.api.functions.async.{AsyncFunction, ResultFuture}
//import org.apache.flink.streaming.api.scala.{AsyncDataStream, DataStream}
//
//import scala.concurrent.{ExecutionContext, Future}
//
///**
//  * 创建人    BurgessLee
//  * 创建时间   2020/2/4
//  * 描述     自定义实现AsyncFunction接口，实现数据库数据异步查询
//  */
//class AsyncDBFunction extends AsyncFunction[String, (String, String)]{
//
//	//创建数据连接的异步客户端，能够支持数据的异步查询
//	lazy val dbclient:DBClient = new DBClient(host,port)
//	//用于feature callbacks的context
//	implicit lazy val executor: ExecutionContext = ExecutionContext.fromExecutor(Executors.directExecutor())
//	//复写asyncInvoke方法，实现AsyncFunction触发数据库数据查询
//	override def asyncInvoke(in: String, resultFuture: ResultFuture[(String, String)]): Unit = {
//		//通过client查询数据传入字符串，返回Future对象
//		val resultFutureRequewsted: Future[String] = dbclient.query(str)
//		//当客户端查询完请求后，通过调用callback将查询结果返回给resultFuture
//		resultFutureRequewsted.onSuccess{
//			case result: String => resultFuture.complete(Iterable((str, result)))
//		}
//	}
//	//创建数据集
//	val stream: DataStream[String] = ...
//	//将现有的DataStream上应用创建好的AsyncDatabaseRequest方法，返回查询结果后回应的数据集
//	AsyncDataStream.unorderedWait(stream, new AsyncDatabaseRequest(), 1000, TimeUnit.MILLISECONDS, 100)
//}